package com.ruoyi.hospital.service.order.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.hospital.domain.shop.ShopOrdersCart;
import com.ruoyi.hospital.mapper.shop.ShopOrdersCartMapper;
import com.ruoyi.hospital.service.order.IShopOrdersCartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 购物车Service业务层处理
 * 
 * @author wendao
 * @date 2025-06-09
 */
@Service
public class ShopOrdersCartServiceImpl implements IShopOrdersCartService
{
    @Autowired
    private ShopOrdersCartMapper shopOrdersCartMapper;

    /**
     * 查询购物车
     * 
     * @param id 购物车主键
     * @return 购物车
     */
    @Override
    public ShopOrdersCart selectShopOrdersCartById(Integer id)
    {
        return shopOrdersCartMapper.selectShopOrdersCartById(id);
    }

    /**
     * 查询购物车列表
     * 
     * @param shopOrdersCart 购物车
     * @return 购物车
     */
    @Override
    public List<ShopOrdersCart> selectShopOrdersCartList(ShopOrdersCart shopOrdersCart)
    {
        return shopOrdersCartMapper.selectShopOrdersCartList(shopOrdersCart);
    }

    /**
     * 新增购物车
     * 
     * @param shopOrdersCart 购物车
     * @return 结果
     */
    @Override
    public int insertShopOrdersCart(ShopOrdersCart shopOrdersCart)
    {
        shopOrdersCart.setCreateTime(DateUtils.getNowTimeSecond());
        return shopOrdersCartMapper.insertShopOrdersCart(shopOrdersCart);
    }

    /**
     * 修改购物车
     * 
     * @param shopOrdersCart 购物车
     * @return 结果
     */
    @Override
    public int updateShopOrdersCart(ShopOrdersCart shopOrdersCart)
    {
        return shopOrdersCartMapper.updateShopOrdersCart(shopOrdersCart);
    }

    /**
     * 批量删除购物车
     * 
     * @param ids 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteShopOrdersCartByIds(Integer[] ids)
    {
        return shopOrdersCartMapper.deleteShopOrdersCartByIds(ids);
    }

    /**
     * 删除购物车信息
     * 
     * @param id 购物车主键
     * @return 结果
     */
    @Override
    public int deleteShopOrdersCartById(Integer id)
    {
        return shopOrdersCartMapper.deleteShopOrdersCartById(id);
    }
}
